var hosturl = "";
AFRAME.registerComponent("cursor-listener", {
	init : function() {
	 
	},
	update : function(oldData) {
	},
	remove : function() {
	}
});
 
 
 
  
var getcamera = function(id) {
	var vraform = vr_items.vraform[id];
	if (vraform && vraform.camera) {
		return vraform.camera;
	}
	return null;
};
var openvr=function(Nodes){
	
	getobj2html([{
		"nodeName" : "A-SCENE",
		"Nodes" : Nodes
	}], document.body);

}
 
window.onload = function() {
	var vraform = Nodes; 
	var argv=new evi().getArgv(); 
	console.log(argv)
	"file://"+process.cwd()+"/static/images/demo.jpg"

	var src= "file://"+process.cwd()+"/static/images/demo.jpg";
	if(argv.file){
		src= "file://"+	argv.file;
	}else if(argv.url){
		src=  argv.url
	}
	var Nodes = [{
		"nodeName" : "A-ENTITY",
		"Nodes" : [{
			"nodeName" : "A-CAMERA",
			"Nodes" : [{
				"nodeName" : "A-CURSOR",
				"color" : "#000",
				"Nodes" : []
			}]
		}]
	},  {
		"nodeName" : "A-SKY",
		"src" : src
	} ]; 
	openvr(Nodes)
};
var getobj2html = function(Nodes, parentNode) {
	var ls = [];
	for (var i = 0; i < Nodes.length; i++) {
		var Node = Nodes[i];
		var hobject = document.createElement(Node.nodeName);
		for (var key in Node) {
			if (key != "Nodes" && key != "nodeName") {
				hobject.setAttribute(key, Node[key]);
			}
		};
		if(Node.Nodes){
		getobj2html(Node.Nodes, hobject);
		}
		if (parentNode != null) {
			parentNode.appendChild(hobject);
		} else {
			ls.push(hobject);
		}
	}
	return ls;
};
